<?php

namespace App\Http\Middleware;

use Closure;
use App\Common\ApiResponse;

class VerifyIsBindMobile
{
    use ApiResponse;

    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        return auth('api')->user()->user_id ? $next($request) : $this->failed('此操作需要绑定手机', 406);
    }
}
